package cs271.examples.binarytrees;

import junit.framework.TestCase;

public class UtilTest extends junit.framework.TestCase {

    public UtilTest() {
    }
    
    public void testTreeHeight() {
        BinaryTreeElement root = new BinaryTreeElement();
        
        root.setLeft(new BinaryTreeElement());
        root.setRight(new BinaryTreeElement());
        root.getRight().setLeft(new BinaryTreeElement());
        
        assertEquals(BinaryTreeUtil.heightOfTree(root), 2);
    }
    
    public void testTreeCount() {
        BinaryTreeElement root = new BinaryTreeElement();
        
        root.setLeft(new BinaryTreeElement());
        root.setRight(new BinaryTreeElement());
        root.getRight().setLeft(new BinaryTreeElement());
        
        assertEquals(BinaryTreeUtil.countNumberOfNodes(root), 4);
    }
}
